﻿using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Text;

namespace SuperX.Common.AppConfiguration
{
    //
    public class SystemCfg
    {
        //
        public LogCfg LogConfig { get; set; }

        //
        public ProjectCfg ProjectConfig { get; set; }

        //
        public RunnerCheckCfg RunnerCheckConfig { get; set; }

        public ListenerCheckCfg ListenerCheckCfg { get; set; }

        //
        [JsonProperty(DefaultValueHandling = 0)]
        public bool EnableMortoring { get; set; } = true;

        //
        public bool RunnerExitNeedPassword { get; set; }

        //
        public string RunnerExitPassword { get; set; } = "";

        //
        public bool UseWPFVersion { get; set; }

        //
        public string DownOrUploadExcludePaths { get; set; } = "Runtime";

        //
        public string LogViewConfig { get; set; } = "";

        /// <summary>
        /// IoT服务名
        /// </summary>
        public string IoTServiceName { get; set; }

        /// <summary>
        /// 监听服务名
        /// </summary>
        public string ListenServiceName { get; set; }

        public string IP { get; set; }

        /// <summary>
        /// 0:Sqlite;1:Mysql;2:Sqlserver
        /// </summary>
        public DatabaseProvider CacheDbType { get; set; }

        public DBMessage DBMessage { get; set; }

        public SystemCfg()
        {
            this.LogConfig = new LogCfg();
            this.ProjectConfig = new ProjectCfg();
            this.RunnerCheckConfig = new RunnerCheckCfg();
        }

        //
        [JsonExtensionData]
        public JObject ExtensionData { get; set; }
    }

    public class DBMessage
    {
        public string ServerName { get; set; }

        public string Name { get; set; }

        public string UserId { get; set; }

        public string Password { get; set; }

        public int Port { get; set; }
    }
}